/**
 * 
 */
package org.chungyan5.flashcard;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author yan
 *
 */
public class ChineseNum implements Lesson {

	private int cnt = 11;
	
	private char[] chineseArr = new char[] {'零', '一', '二', '三', '四', 
			'五', '六', '七', '八', '九', '十'}; 

	public ChineseNum() {
	}

	public ChineseNum(Parcel source) {
		cnt = source.readInt();
		source.readCharArray(chineseArr);
	}

	@Override
	public int getCnt() {
		return cnt;
	}

	@Override
	public String convert(int index) {
		return String.valueOf(chineseArr[index]);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(cnt);
		dest.writeCharArray(chineseArr);
	}

	/**
	 * It will be required during un-marshaling data stored in a Parcel
	 * @author prasanta
	 */
	public static final Parcelable.Creator<ChineseNum> CREATOR = new Parcelable.Creator<ChineseNum>() {  
	    
        public ChineseNum createFromParcel(Parcel in) {  
            return new ChineseNum(in);  
        }  
   
        public ChineseNum[] newArray(int size) {  
            return new ChineseNum[size];  
        }  
          
    };
}
